package com.ruoyi.service.jpjs.outputvalue.impl;

import com.ruoyi.mapper.jpjs.outputvalue.OutPutValueMapper;
import com.ruoyi.service.jpjs.PublicService;
import com.ruoyi.service.jpjs.outputvalue.OutPutValueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class OutPutValueServiceimpl implements OutPutValueService {

    @Autowired
    OutPutValueMapper outPutValueMapper;

    @Autowired
    PublicService publicService;

    @Override
    public List<Map<String, Object>> findOutPutValueAll(Map map) {
        List<Map<String, Object>> compList = publicService.findUserComp();
        map.put("compList", compList);
        return outPutValueMapper.findOutPutValueAll(map);
    }

    @Override
    public Map<String, Object> findOutPutValueById(String id) {
        return outPutValueMapper.findOutPutValueById(id);
    }

    @Override
    public int add(Map map) {
        return outPutValueMapper.add(map);
    }

    @Override
    public int edit(Map map) {
        return outPutValueMapper.edit(map);
    }

    @Override
    public List<Map<String, Object>> findPlanValueList(Map map) {
        List<Map<String, Object>> compList = publicService.findUserComp();
        map.put("compList", compList);
        return outPutValueMapper.findPlanValueList(map);
    }

    @Override
    public List<Map<String, Object>> findProByCompId(String compId) {
        return outPutValueMapper.findProByCompId(compId);
    }

    @Override
    public int addPlanValue(Map map) {
        return outPutValueMapper.addPlanValue(map);
    }

    @Override
    public int editPlanValue(Map map) {
        return outPutValueMapper.editPlanValue(map);
    }

    @Override
    public int findYearPlanCount(Map map) {
        return outPutValueMapper.findYearPlanCount(map);
    }

    @Override
    public String findYearPlanMonthCount(Map map) {
        return outPutValueMapper.findYearPlanMonthCount(map);
    }

    @Override
    public List<Map<String, Object>> findActualValueList(Map map) {
        List<Map<String, Object>> compList = publicService.findUserComp();
        map.put("compList", compList);
        return outPutValueMapper.findActualValueList(map);
    }

    @Override
    public int addActualValue(Map map) {
        return outPutValueMapper.addActualValue(map);
    }

    @Override
    public int editActualValue(Map map) {
        return outPutValueMapper.editActualValue(map);
    }

    @Override
    public int findYearActualCount(Map map) {
        return outPutValueMapper.findYearActualCount(map);
    }

    @Override
    public String findYearActualMonthCount(Map map) {
        return outPutValueMapper.findYearActualMonthCount(map);
    }

    @Override
    public int remove(String ids) {
        String[] idSplit = ids.split(",");
        int num = 0;
        for (String id : idSplit) {
            num += outPutValueMapper.remove(id);
        }
        return num;
    }

    @Override
    public Map<String, Object> findMonthOutPutValueById(String id) {
        return outPutValueMapper.findMonthOutPutValueById(id);
    }
}
